<?php

  class Smtp{

        var $server;
		var $port=25;
        var $from;
        var $rcpt;
        var $subject;
        var $texte;

        function __construct(){

        }



        function ligne($fp, $msg, $vide=0){
             fputs($fp, "$msg");
             if($vide) fgets($fp, 1024);

        }

        function envoyer(){

             $fp = fsockopen($this->server, $this->port);

             $this->ligne($fp, "helo server\r\n");
             $this->ligne($fp, "mail from: " . $this->from . "\r\n");
             $this->ligne($fp, "rcpt to: " . $this->rcpt . "\r\n");
             $this->ligne($fp, "data\r\n");
             $this->ligne($fp, "From: " . $this->from . "\r\n");
             $this->ligne($fp, "To: " . $this->rcpt ."\r\n");
             $this->ligne($fp, "Subject: " . $this->subject . "\r\n");
             $this->ligne($fp, "\r\n");
             $this->ligne($fp, $this->texte . "\r\n");
             $this->ligne($fp, ".\r\n", 1);
       }

 }
?>